package cn.studyjams.s1.contest.autohello.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by liuyang
 * on 2016/10/8.
 */

public class RegexValidateUtil {

    public static boolean isEmailValid(String email) {
        boolean flag;
        try {
            String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
            Pattern regex = Pattern.compile(check);
            Matcher matcher = regex.matcher(email);
            flag = matcher.matches();
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }

//    public static boolean isMobileNumberValid(String mobileNumber){
//        boolean flag;
//        try{
//            Pattern regex = Pattern.compile("^(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8})|(0\\d{2}-\\d{8})|(0\\d{3}-\\d{7})$");
//            Matcher matcher = regex.matcher(mobileNumber);
//            flag = matcher.matches();
//        }catch(Exception e){
//            flag = false;
//        }
//        return flag;
//    }

    public static boolean isPasswordValid(String password) {
        return password.length() > 5;
    }
}
